<h1 itemprop="name" class="titulo">
    <a href="<?php echo $this->urlbase;?>/cases">Cases</a>
</h1>
<div class="cnt-texto">
<?php 
$cont = 0;
foreach ($this->result as $row){
    $imgs = glob('public/upload/cases/'.$row['CAS_ID'].'.*');
    $class = (($cont % 2) == 0) ? 'left':'right';
    $cont++;
    $link = strlen($row['CAS_URLLNK']) > 1  ? $row['CAS_URLLNK']:'javascript:void(0)';
    ?>
    <div class="cnt-cas">
        <a href="<?php echo $link?>" target="_blank">
            <?php if(strlen($row['CAS_IMGLNK']) > 0){ ?>
            <img class="<?php echo $class; ?>" src="<?php echo $row['CAS_IMGLNK'];?>" width="300px" height="200px" />
            <?php } else {?>
            <img class="<?php echo $class; ?>" src="<?php echo $this->urlbase.'/'.$imgs[0]; ?>" />
            <?php }?>
        <a>
        <div class="txt">
            <h1><?php echo $row['CAS_NOM'];?></h1>
            <?php echo $row['CAS_DES'];?>
        </div>    
    </div>
<?php } ?>
</div>